package com.yonyou.lxp.account.utils;

import android.content.Context;
import android.view.View;

import me.drakeet.materialdialog.MaterialDialog;

/**
 * Created by liuxiaopeng on 16/2/28.
 */
public class DialogUtils {
    private static MaterialDialog mMaterialDialog;

    public static void showDialog(Context mContext, String title, String msg,final MyOnClick onClick) {
        mMaterialDialog = new MaterialDialog(mContext)
                .setTitle(title)
                .setMessage(msg)
                .setPositiveButton("确认", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        onClick.onClick();
                        mMaterialDialog.dismiss();
                    }
                })
                .setNegativeButton("取消", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mMaterialDialog.dismiss();
                    }
                });
        mMaterialDialog.show();
    }

    public static MaterialDialog getDailog(Context mContext) {
        mMaterialDialog = new MaterialDialog(mContext);
//                .setPositiveButton("确认", new View.OnClickListener() {
//                    @Override
//                    public void onClick(View v) {
//                        mMaterialDialog.dismiss();
//                    }
//                })
//                .setNegativeButton("取消", new View.OnClickListener() {
//                    @Override
//                    public void onClick(View v) {
//                        mMaterialDialog.dismiss();
//                    }
//                });
        return mMaterialDialog;
    }

    public interface MyOnClick{
        public void onClick();
    }
}
